package com.mysterymall.Controller.Admin;

import com.mysterymall.Common.Comp.Log;
import com.mysterymall.Common.Utils.Result;
import com.mysterymall.Model.Dto.CustomerServiceDto;
import com.mysterymall.Service.MarketingService;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName com.mysterymall.Controller.Admin
 * @Description 营销控制器
 * @Author HuangWX
 * @Time 2024/01/05  14:15
 */
@RestController
@RequestMapping("/marketing")
public class AdminMarketingController {


    private final MarketingService marketingService;


    public AdminMarketingController(MarketingService marketingService) {
        this.marketingService = marketingService;
    }

    // 获取营销数据
    @GetMapping("/getMarketingData")
    @Log
    public Result getMarketingData(@RequestParam("startTime")String startTime,
                                   @RequestParam("endTime")String endTime){
        return marketingService.getMarketingData( startTime, endTime);
    }

    // 添加客服介绍
    @PostMapping("/addCustomerService")
    @Log
    public Result addCustomerService(@RequestBody CustomerServiceDto customerServiceDto){
        return marketingService.addCustomerService(customerServiceDto);
    }


    // 添加玩法介绍
    @PostMapping("/addPlayingMethod")
    @Log
    public Result addPlayingMethod(@RequestBody CustomerServiceDto customerServiceDto){
        return marketingService.addPlayingMethod(customerServiceDto);
    }

    @PostMapping("/addLogo")
    @Log
    public Result addLogo(@RequestBody CustomerServiceDto customerServiceDto){
        return marketingService.addLogo(customerServiceDto);
    }


    @GetMapping("/getCustomerService")
    @Log
    public Result getCustomerService(){
        return marketingService.getCustomerService();
    }


    @GetMapping("/getCustomerServiceUser")
    @Log
    public Result getCustomerServiceUser(HttpServletRequest request){
        return marketingService.getCustomerServiceUser(request);
    }




    @GetMapping("/delete")
    @Log
    public Result delete(@RequestParam("id")String id){
        return marketingService.delete(id);
    }

}
